package chaoyue.study.entity;

import chaoyue.study.enums.GradeEnum;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * @author chaoyue
 * @since 2024-12-22
 */
@Getter
@Setter
@ToString
@NoArgsConstructor
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 姓名
     */
    private String name;

    /**
     * 年龄
     */
    private Integer age;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 年级
     * 测试自动映射枚举，如果映射不上则设置为NULL
     */
    private GradeEnum grade;

    public User(Integer id, String name, String email) {
        this.id = id;
        this.name = name;
        this.age = 0;
        this.email = email;
    }

    public User(String name, String email) {
        this.name = name;
        this.age = 0;
        this.email = email;
    }
}
